# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: team/kde <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-frameworks
pkgname=kwallet
pkgver=6.1.0
pkgrel=0
pkgdesc="Secure and unified container for user passwords"
# armhf blocked by extra-cmake-modules
arch="all !armhf"
url="https://community.kde.org/Frameworks"
license="LGPL-2.1-or-later"
depends_dev="
	gpgme-dev
	kconfig-dev
	kconfigwidgets-dev
	kcoreaddons-dev
	kdbusaddons-dev
	ki18n-dev
	kiconthemes-dev
	knotifications-dev
	kservice-dev
	kwindowsystem-dev
	libgcrypt-dev
	qca-qt6-dev
	"
makedepends="$depends_dev
	doxygen
	extra-cmake-modules
	graphviz
	kdoctools-dev
	qt6-qttools-dev
	samurai
	"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang $pkgname-bin"
_repo_url="https://invent.kde.org/frameworks/kwallet.git"
source="https://download.kde.org/stable/frameworks/${pkgver%.*}/kwallet-$pkgver.tar.xz"

provides="dbus:org.freedesktop.Secrets"
# 2nd highst priority after gnome-keyring, mainly for KDE
provider_priority=10

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_QCH=ON
	cmake --build build
}

check() {
	local excluded_checks=
	case "$CARCH" in
		s390x) excluded_checks="(blowfishtest)";;
	esac
	ctest --test-dir build --output-on-failure -E "$excluded_checks"
}

package() {
	DESTDIR="$pkgdir" cmake --install build

	rm "$pkgdir"/usr/share/dbus-1/services/org.kde.kwalletd5.service
}

doc() {
	replaces="kwallet5-doc"

	default_doc
}

bin() {
	amove usr/bin/kwallet-query
}

sha512sums="
fb0428a76788d556ffc6c18a649f5e4de96b57234931e2e878ea660c612384c9778367db26089d73f0499b0d5d5cffcc9b193ca97a03aa3504180b483170c88b  kwallet-6.1.0.tar.xz
"
